package com.zr.action;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.zr.datamodel.OrderDM;
import com.zr.service.OrderService;

import net.sf.json.JSONObject;

@Controller
@Scope(value = "prototype") // 以多例的方式生成
public class OrderAction extends ActionSupport implements ServletResponseAware{
	private int page;
	private int rows;
	private  HttpServletResponse  resp;
	
	@Resource
	private  OrderService  orderService;
	public void showMsg(){
		JSONObject  obj = orderService.findOrderMsg(page, rows);
		System.out.println(obj);
		try {
			resp.getWriter().write(obj.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	@Override
	public void setServletResponse(HttpServletResponse response) {
		// TODO Auto-generated method stub
		this.resp=response;
	}
}
